export default class AdAdapter {

    protected _ad: any;
    protected _data: any;
    constructor(ad: any, data?: any) {
        this._ad = ad;
        this._data = data;
    }
    onLoad(func: Function) {
        if (this._ad.onLoad)
            this._ad.onLoad(func)
    }

    onError(func: Function) {
        if (this._ad.onError)
            this._ad.onError(func)
    }

    onClose(func: Function) {
        if (this._ad.onClose)
            this._ad.onClose(func)
    }


    offLoad(func: Function) {
        if (this._ad.offLoad)
            this._ad.offLoad(func)
    }

    offError(func: Function) {
        if (this._ad.offError)
            this._ad.offError(func)
    }

    offClose(func: Function) {
        if (this._ad.offClose)
            this._ad.offClose(func)
    }

    show() {
        if (this._ad.show)
            return this._ad.show()
    }

    load() {
        if (this._ad.load)
            return this._ad.load();
    }

    destroy() {
        if (this._ad.destroy)
            this._ad.destroy();

    }

    reportAdClick(obj: any) {
        this._ad.reportAdClick(obj)
    }

    reportAdShow(obj: any) {
        this._ad.reportAdShow(obj)
    }

    onResize(func: Function) {
        if (this._ad.onResize) {
            this._ad.onResize(func)
        }
    }

    offResize(func: Function) {
        if (this._ad.offResize) {
            this._ad.offResize(func)
        }
    }
    hide() {
        if (this._ad.hide)
            this._ad.hide()
    }
    set style(s: any) {
        this._ad.style = s;
    }

    get style() {
        return this._ad.style;
    }
}
